/*
 * conexionBD.java
 *
 * Created on 5 de septiembre de 2007, 11:27 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package conexionBD;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.sqlite.JDBC;
/**
 *
 * @author Billy
 */
public class conexionBD {
    private static conexionBD ref=new conexionBD();
    /** Creates a new instance of ConexionJDBC */
    private conexionBD() {
        try {
//            Class.forName("com.mysql.jdbc.Driver");
            Class.forName("org.sqlite.JDBC");
            
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }        
    }
    public static void close(PreparedStatement stm){
        try {
            stm.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    public static Connection getConnection()throws SQLException{
//        String url="jdbc:mysql://www.brosland.net:3306/brosland_tesisBilly";
//        return DriverManager.getConnection(url,"brosland_billy","billy");
        
//        String url="jdbc:mysql://localhost:3306/tesis";
//        return DriverManager.getConnection(url,"root","");
        
//        String url="jdbc:mysql://localhost:3306/tesis2";
//        return DriverManager.getConnection(url,"root","billy");
        
        return DriverManager.getConnection("jdbc:sqlite:sqlite_tesis2.db3");
       
        
    }
    public static void close(ResultSet rs){
        try {
            rs.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    public static void close(Statement stmt){
        try {
            stmt.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    public static void close(Connection conn){
        try {
            conn.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
}

